{block name="title" prepend}{$LNG.lm_buildings}{/block}
{block name="content"}
{if !empty($Queue)}
<div id="buildlist" class="buildlist">
	<table style="width:760px">
		{foreach $Queue as $List}
		{$ID = $List.element}
		<tr>
			<td style="width:70%;vertical-align:top;" class="left">
				{$List@iteration}.: 
				{if !($isBusy.research && ($ID == 6 || $ID == 31)) && !($isBusy.shipyard && ($ID == 15 || $ID == 21)) && $RoomIsOk && $CanBuildElement && $BuildInfoList[$ID].buyable}
				<form class="build_form" action="game.php?page=buildings" method="post">
					<input type="hidden" name="cmd" value="insert">
					<input type="hidden" name="building" value="{$ID}">
					<button type="submit" class="build_submit onlist">{$LNG.tech.{$ID}} {$List.level}{if $List.destroy} {$LNG.bd_dismantle}{/if}</button>
				</form>
				{else}{$LNG.tech.{$ID}} {$List.level} {if $List.destroy}{$LNG.bd_dismantle}{/if}{/if}
				{if $List@first}
				<br><br><div id="progressbar" data-time="{$List.resttime}"></div>
			</td>
			<td>
				<div id="time" data-time="{$List.time}"><br></div>
				<form action="game.php?page=buildings" method="post" class="build_form">
					<input type="hidden" name="cmd" value="cancel">
					<button type="submit" class="build_submit onlist">{$LNG.bd_cancel}</button>
				</form>
				{else}
			</td>
			<td>
				<form action="game.php?page=buildings" method="post" class="build_form">
					<input type="hidden" name="cmd" value="remove">
					<input type="hidden" name="listid" value="{$List@iteration}">
					<button type="submit" class="build_submit onlist">{$LNG.bd_cancel}</button>
				</form>
				{/if}
				<br><span style="color:lime" data-time="{$List.endtime}" class="timer">{$List.display}</span>
			</td>
		</tr>
	{/foreach}
	</table>
</div>
{/if}
<table style="width:760px">
<tr><td colspan="3" style="border:#333 1px solid; border-radius:2px; background:none"><div id="poli" style="width:{$raz}%"><span>
 Поля: <a style="cursor:help;" title="Занято полей на планете">{$planet_field_current}</a> / <a style="cursor:help;" title="Количество полей на планете">{$planet_field_max}</a> Свободно: <a style="color:#FC0">{$planet_field_max - $planet_field_current}</a></span></div>
        </td></tr>	
	{foreach $BuildInfoList as $ID => $Element}
	<tr>
		<td rowspan="2" style="width:120px;">
			<a href="#" onclick="return Dialog.info({$ID})">
				<img src="{$dpath}gebaeude/{$ID}.gif" alt="{$LNG.tech.{$ID}}" width="120" height="120">
			</a>
		</td>
		<th>
        <span style="float:left; display:block;">
			<a href="#" onclick="return Dialog.info({$ID})">{$LNG.tech.{$ID}}</a>{if $Element.level > 0} ({$LNG.bd_lvl} {$Element.level}{if $Element.maxLevel != 255}/{$Element.maxLevel}{/if}){/if}
        </span>   
            {if $Element.level > 0}
            <span style="float:right; display:block;">
				{if $ID == 43}
                	<a href="#" onclick="return Dialog.info({$ID})">{$LNG.bd_jump_gate_action}</a> 
                {/if}
				{if ($ID == 44 && !$HaveMissiles) ||  $ID != 44}
                <a class="tooltip_sticky" data-tooltip-content="<table style='width:300px'><tr><th colspan='2'>{$LNG.bd_price_for_destroy} {$LNG.tech.{$ID}} {$Element.level}</th></tr>{foreach $Element.destroyRessources as $ResType => $ResCount}<tr><td>{$LNG.tech.{$ResType}}</td><td>{$ResCount|number}</td></tr>{/foreach}<tr><td>{$LNG.bd_destroy_time}</td><td>{$Element.destroyTime|time}</td></tr><tr><td colspan='2'><form action='game.php?page=buildings' method='post' class='build_form'><input type='hidden' name='cmd' value='destroy'><input type='hidden' name='building' value='{$ID}'><button type='submit' class='build_submit onlist'>{$LNG.bd_dismantle}</button></form></td></tr></table>">{$LNG.bd_dismantle}</a>
                            {/if}
            </span>
            {/if}
		</th>
	</tr>
	<tr style="padding:0;">
		<td style="padding:0;">
        <div style="position:relative; padding:0; height:100px;">
			<div style=" width:75%; padding-left:5px; padding-top:10px; float:left; text-align:left;">
            	{$LNG.shortDescription.{$ID}}
            </div>
            <div style="max-width:20%; min-width:15%; float:right; text-align:center; padding-top:20px; padding-right:10px;">
					{if $Element.maxLevel == $Element.level}
						<span style="color:red">{$LNG.bd_maxlevel}</span>
					{elseif ($isBusy.research && ($ID == 6 || $ID == 31)) || ($isBusy.shipyard && ($ID == 15 || $ID == 21))}
						<span style="color:red">{$LNG.bd_working}</span>
					{else}
						{if $RoomIsOk}
							{if $CanBuildElement && $Element.buyable}
							<form action="game.php?page=buildings" method="post" class="build_form">
								<input type="hidden" name="cmd" value="insert">
								<input type="hidden" name="building" value="{$ID}">
								<button type="submit" class="build_submit">{if $Element.level == 0}{$LNG.bd_build}{else}{$LNG.bd_build_next_level}{$Element.level + 1}{/if}</button>
							</form>
							{else}
							<span style="color:red">{if $Element.level == 0}{$LNG.bd_build}{else}{$LNG.bd_build_next_level}{$Element.level + 1}{/if}</span>
							{/if}
						{else}
						<span style="color:red">{$LNG.bd_no_more_fields}</span>
						{/if}
					{/if}
                    </div>
                    <div style="position:absolute;padding-right:20px; padding-left:10px; left:0; bottom:0; border-top-right-radius:20px; line-height:20px; border-top:#666666 solid 2px;">
                        {foreach $Element.costRessources as $RessID => $RessAmount}
                        {$LNG.tech.{$RessID}}: <b><span style="color:{if $Element.costOverflow[$RessID] == 0}lime{else}red{/if}">{$RessAmount|number}</span></b>
                        {/foreach}
                    </div>
                    <div style="padding-right:5px; padding-left:15px; position:absolute; right:0; bottom:0;  border-top:2px solid #666666; border-top-left-radius:20px; line-height:20px; color:#FFCC00;">
						{$Element.elementTime|time}
					</div>
			</div>
		</td>
	</tr>
	<tr>
		<td colspan="2" style="margin-bottom:10px;">  
			<table style="width:100%">
				<tr>
					<td class="transparent left">
						{$LNG.bd_remaining}
						{foreach $Element.costOverflow as $ResType => $ResCount}
						{$LNG.tech.{$ResType}}: <span style="font-weight:700">{$ResCount|number}</span> 
						{/foreach}
                        {if !empty($Element.infoEnergy)}{$Element.infoEnergy}{/if}
					</td>
				</tr>
			</table>
		</td>
	</tr>
	{/foreach}
    <tr>
    	<td class="transparent" style="text-align:left" colspan="3">
        	<a href="game.php?page=buildings&amp;mode=inter">Компактный вид</a>
            <br /> Мгновенная покупка за Темную материю <a href="game.php?page=dmbuild">[Построек]</a>
        </td>
    </tr>
</table>
{/block}